﻿using BasicData.API.Read.Application.Commands;
using BasicData.Domain;
using BasicData.ErrorCode;
using BasicData.Infrastructure.interfaces;
using MediatR;

namespace BasicData.API.Read.Application.CommandHandlers
{
  
    public class GetKuCommandHandler : IRequestHandler<GetKuCommand, APIResult<List<KuModel>>>
    {
        private readonly IBaseRepository<KuModel> baseRepository;

        public GetKuCommandHandler(IBaseRepository<KuModel> baseRepository)
        {
            this.baseRepository = baseRepository;
        }

        public async Task<APIResult<List<KuModel>>> Handle(GetKuCommand request, CancellationToken cancellationToken)
        {
            var list = baseRepository.GetAll();



            return APIResult<List<KuModel>>.Success("显示成功", list.ToList());
        }
    }
}
